package kgame5.k3d.core.obj3d.bound {
import kgame5.k3d.core.math.Vertex3D;

/**
 * @author kk
 * 边界球
 */
public class BBall {
	public var R:int=0;

//	public  static function CreateFromVertices(aVB_p:Vector.<Vector3D>):BBall{
//		var R2:int=0;
//		for(var i:int=0;i<aVB_p.length;i++){
//				
//			var vv:Vector3D=aVB_p[i];
//				
//			R2=Math.max(R2, vv.magnitude2());
//		}
//		var bsphere:BBall=new BBall();
//		bsphere.R=Math.sqrt(R2);
//		return bsphere;
//	}
	
	public  static function CreateFromVertices(aVertex:Vector.<Vertex3D>):BBall{
		var R2:int=0;
		for each(var vv:Vertex3D in aVertex){
			R2=Math.max(R2, vv.magnitude2());
		}
		var bsphere:BBall=new BBall();
		bsphere.R=Math.sqrt(R2);
		return bsphere;
	}
	
	public function toString():String{
		return "BBall R:"+R;
	}
}
}
